package com.good.webapi.Controller;

import com.good.domain.controller.BaseController;
import com.good.domain.models.Result;
import com.good.webapi.Models.SmsModel;
import com.good.webapi.Util.SignClass;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static org.springframework.web.bind.annotation.RequestMethod.POST;


@RestController
/**
 * 发送短信
 */
@Api("发送短信接口")
@RequestMapping("/api")
public class SmsController extends BaseController {
    @RequestMapping(value = "/send", method = POST)
    @ApiOperation(value = "发送短信",notes = "keys为:type +String.valueOf(code) + mobile")

    public Result Send(@RequestBody SmsModel smsModel) {
        if (!SignClass.check(smsModel.timestamp, smsModel.sign, smsModel.toString())) {
           return SignError();
        } else {
           return   Success("发送成功");
        }

    }
}


